#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Name : __init__.py
# Author: ls_seraph@126.com
# Time  : 2021/3/6 22:46

import os
from frame.common.util.log_utils import logger as log
from frame.common.base.page_base import PageBase
from frame.common.util.element_date_utils import ElementDateUtils
from frame.common.global_data.path_param import Param


class LoginPages(PageBase):
    def __init__(self, driver):
        super().__init__(driver)
        path = os.path.abspath(os.path.join(__file__))
        py_file_name = os.path.basename(path)[:-3]
        self.excel = ElementDateUtils(Param.get_value('path') + '/element/data.xlsx')
        self.elements = self.excel.get_element_info(py_file_name)

    # 页面操作方法
    def input(self, e, value):
        super().input(self.elements[e], value)
        log.info('输入元素[' + e + ']备注[' + self.elements[e].element_name + ']输入值[' + str(value) + ']')

    def click(self, e):
        super().click(self.elements[e])
        log.info('输入元素[' + e + ']备注[' + self.elements[e].element_name + ']')

    def clear(self, e):
        super().input_clean(self.elements[e])
        log.info('输入元素[' + e + ']备注[' + self.elements[e].element_name + ']')
